package tg.app.rj.outsedtail;

import java.rmi.RemoteException;
import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.server.MXServer;
import psdi.util.MXException;

/***
 * 
 * @author pzx
 *
 */
public class OutsDetail extends Mbo
  implements OutsDetailRemote
{
  public OutsDetail(MboSet arg0)
    throws RemoteException
  {
    super(arg0);
  }

  public void add()
    throws MXException, RemoteException
  {    
	super.add();
    setValue("enterby", getUserInfo().getPersonId(), 11L);
    setValue("enterdate", MXServer.getMXServer().getDate(), 11L);
    setValue("xh", getThisMboSet().max("xh")+1, 11L);
    MboRemote parent = getOwner();
    if(parent!=null){
    	 setValue("outsournum", parent.getString("outsournum"), 11L);
    	 setValue("siteid", parent.getString("siteid"),11L);
    	 setValue("orgid", parent.getString("orgid"),11L);
    }else{
        setValue("siteid",getInsertSite(),11L);
        setValue("orgid", getInsertOrganization(),11L);
    }

  }
}